package com.cnblogs.leizia.crm.workbench.service.impl;

import com.cnblogs.leizia.crm.utils.SqlSessionUtil;
import com.cnblogs.leizia.crm.workbench.dao.CustomerDao;
import com.cnblogs.leizia.crm.workbench.domain.Customer;
import com.cnblogs.leizia.crm.workbench.service.CustomerService;

import java.util.List;

/**
 * @author leizi
 * @create 2021-04-05 19:43
 */
public class CustomerServiceImpl implements CustomerService {
    /**
     * 获取客户名称列表
     *
     * @param name
     * @return
     */
    @Override
    public List<String> getCustomerName(String name) {
        CustomerDao customerDao = SqlSessionUtil.getSqlSession().getMapper(CustomerDao.class);

        return customerDao.getCustomerNameList(name);
    }

    /**
     * 根据客户名称查找客户信息
     *
     * @param company
     * @return
     */
    @Override
    public Customer getCustomer(String company) {
        CustomerDao customerDao = SqlSessionUtil.getSqlSession().getMapper(CustomerDao.class);

        return customerDao.getCustomer(company);
    }
}
